import { createRouter, createWebHistory } from 'vue-router';
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';

import List from '@/views/List.vue';
import Create from '@/views/Create.vue';

import { name } from '../../package.json';

const baseUrl = qiankunWindow.__POWERED_BY_QIANKUN__ ? `/${name}` : '/'

const routes: any[] = [
    {
        path: '/',
        name: 'list',
        component: List,
    },
    {
        path: '/create',
        name: 'create',
        component: Create,
    }
];

export const router = createRouter({
    history: createWebHistory(baseUrl),
    routes,
})
